function [hxcov,dx] = lpcvd_1DSurface_xcov(h,x)
% Return single side auto-covariance function
hxcov = xcov(h);
hxcov = hxcov(length(h):end);
dx = x - x(1);
if nargout == 0
    plot(dx,hxcov);
    xlabel('x (m)');
    ylabel('xcov(h) (m^2)');
    [a,xcov_1db] = lpcvd_1DSurface_autocorrlength(hxcov,dx);
    hold on;
    plot([0,a],[xcov_1db,xcov_1db],'r--');
    r2 = lpcvd_1DSurface_roughness(h);
    m2 = 2*r2/(a^2);
    title(sprintf('auto-correlation length = %.3e (m), m^2 = %.3e',a,m2));
end
